package com.snoopy.gas1.mapper;

import com.snoopy.gas1.entity.Sales_record;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface Sales_recordMapper {
//    @Select("select * from sales_record")
    List<Sales_record> lists();

    // 模糊查询（按客户名）
//    @Select("SELECT * FROM sales_record WHERE customer LIKE CONCAT('%', #{customer}, '%')")
    List<Sales_record> searchByCustomer(String customer);

//    @Delete("DELETE FROM sales_record WHERE id = #{id}")
    void delete(int id);

    // 添加销售记录
//    @Insert("INSERT INTO sales_record (id, oil_id, sales_quantity, sales_price, sales_date, customer) " +
//            "VALUES (#{id}, #{oil_id}, #{sales_quantity}, #{sales_price}, #{sales_date}, #{customer})")
    int add(Sales_record salesRecord);

//    @Select("SELECT * FROM sales_record WHERE id = #{id}")
    Sales_record getById(int id);

//    @Update("UPDATE sales_record SET oil_id = #{oil_id}, sales_quantity = #{sales_quantity}, " +
//            "sales_price = #{sales_price}, sales_date = #{sales_date}, customer = #{customer} " +
//            "WHERE id = #{id}")
    int update(Sales_record salesRecord);

    List<Sales_record> getSalesRecords();

    // 注册相关（根据实际业务调整）
//    @Insert("INSERT INTO sales_record (oil_id, sales_quantity, sales_price, sales_date, customer) " +
//            "VALUES (#{oil_id}, #{sales_quantity}, #{sales_price}, #{sales_date}, #{customer})")
//    void register(Sales_record salesRecord);
}